package cums.db.impl;

import cums.db.iface.CuseventDao;
import cums.db.pers.Cusevent;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * @time Dec 9, 2009, 1:34:27 PM
 * @author fdcube
 */
public class CuseventImpl extends HibernateDaoSupport implements CuseventDao {

    public Cusevent AddOrUpdateCusevent(Cusevent value) {
        this.getHibernateTemplate().saveOrUpdate(value);
        return value;
    }

    public boolean DeleteCusevent(Cusevent value) {
        try {
            this.getHibernateTemplate().delete(value);
            return true;
        } catch (DataAccessException dataAccessException) {
            logger.error(dataAccessException);
            return false;
        }
    }

    public List<Cusevent> FindCuseventByCeid(int value) {
        return this.getHibernateTemplate().findByNamedParam("FROM CUSEVENT AS ce WHERE ce.CEID =:value", "value", value);
    }

    public List<Cusevent> FindCuseventByEventname(String value) {
        return this.getHibernateTemplate().findByNamedParam("FROM CUSEVENT AS ce WHERE ce.EVENTNAME =:value", "value", value);
    }
}
